/*
 * Access_attributes.cpp
 *
 *  Created on: 10.08.2011
 *      Author: mario
 */

#include "Access_attributes.h"

Access_attributes::Access_attributes() :
        path(""),
        privileges(Access_attributes::NONE)
{
}

Access_attributes::Access_attributes(string path, ACCESS_RIGHTS privileges) :
        path(path),
        privileges(privileges)
{
}

Access_attributes::Access_attributes(ptree &pt)
{
    path = pt.get<string>("path");
    privileges = pt.get<ACCESS_RIGHTS>("priv");
//    path=pt.data();
}

Access_attributes::~Access_attributes()
{
}

void Access_attributes::update_privileges(ACCESS_RIGHTS privileges)
{
    this->privileges = privileges;
}

bool Access_attributes::has_privilege(ACCESS_RIGHTS privileges)
{
    return (this->privileges & privileges);
}



void Access_attributes::save(ptree &pt)
{
    pt.put("path", path);
    pt.put("priv", privileges);
}

